package com.blyat.xsoft.kernel.exception;

import com.blyat.xsoft.kernel.exception.code.ErrorResult;

/**
 * @author syh
 * @date 2019/10/15
 **/
public class BaseException extends RuntimeException {

    private String result;
    private String message;

    public BaseException() {
    }

    public BaseException(String result, String message) {
        this.result = result;
        this.message = message;
    }

    public BaseException(String message, Object... args) {
        super(String.format(message, args));
    }

    public BaseException(ErrorResult error) {
        this(error, null);
    }

    public BaseException(ErrorResult error, Object... args) {
        setResult(error.getResult());
        setMessage(error.getMessage(args));
    }

    public String getResult() {
        return result;
    }

    public void setResult(String code) {
        this.result = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }
}
